package com.ejar.springboot_manage.service.impl;

import com.ejar.springboot_manage.dao.UserMapper;
import com.ejar.springboot_manage.entity.User;
import com.ejar.springboot_manage.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    /**
     * 查询所有成员
     */
    @Override
    public List<User> allUser() {
        return userMapper.allUser();
    }

    /**
     * 增加
     *
     */
    @Override
    public boolean insert(User user) {
        return userMapper.insert(user);
    }

    /**
     * 修改
     *
     * @param user
     */
    @Override
    public boolean update(User user) {
        return userMapper.updateUser(user);
    }

    /**
     * 删除
     *
     * @param id
     */
    @Override
    public boolean delete(Integer id) {
        return userMapper.delete(id);
    }

    /**
     * 根据主键查询整个对象
     *
     * @param id
     */
    @Override
    public User selectByPrimaryKey(Integer id) {
        return userMapper.selectByPrimaryKey(id);
    }
}
